package com.tdkj.util.alipay;

import java.util.HashMap;
import java.util.Map;

public class AlipayUtil {

	public static class Constant {
		public static final String paygateway =	"https://www.alipay.com/cooperate/gateway.do?";	//'支付接口
		public static final String service = "create_direct_pay_by_user";//快速付款交易服务
		public static final String sign_type = "MD5";
		//public static final String out_trade_no	= "";	//商户网站订单
		public static final String input_charset = "utf-8";       
		public static final String partner = ""; //支付宝合作伙伴id (账户内提取)
		public static final String key = ""; //支付宝安全校验码(账户内提取)
		//public static final String body = "阿"; //商品描述，推荐格式：商品名称（订单编号：订单编号）
		//public static final String total_fee = "0.01";				 //订单总价
		public static final String payment_type = "1";//支付宝类型.1代表商品购买
		//public static final String seller_email = ""; //卖家支付宝帐户
		//public static final String subject = "啊啊";	 //商品名称
		public static final String show_url = "www.sina.com.cn";
		public static final String notify_url = "http://10.2.17.136:8081/jsp_direct_utf/alipay_notify.jsp";					//通知接收URL
		public static final String return_url = "http://10.2.17.136:8081/jsp_direct_utf/alipay_return.jsp";	//支付完成后跳转返回的网址URL
		//赋值:bankPay(网银);cartoon(卡通); directPay(余额)
		//三种付款方式都要，参数为空
		public static final String paymethod = "";
		public static final String defaultbank = "ICBCB2C";
	}
	
	public static Map<String,String> getAlipayRequestParameters(String out_trade_no, String subject, String body, String total_fee, String seller_email){
		Map<String,String> parameters = new HashMap<String,String>();
		
		parameters.put("paygateway", Constant.paygateway);
		parameters.put("service", Constant.service);
		parameters.put("sign_type", Constant.sign_type);
		parameters.put("input_charset", Constant.input_charset);
		parameters.put("partner", Constant.partner);
		parameters.put("key", Constant.key);
		parameters.put("payment_type", Constant.payment_type);
		parameters.put("show_url", Constant.show_url);
		parameters.put("notify_url", Constant.notify_url);
		parameters.put("return_url", Constant.return_url);
		parameters.put("paymethod", Constant.paymethod);
		parameters.put("defaultbank", Constant.defaultbank);
		
		//具体产生
		parameters.put("out_trade_no", out_trade_no);
		parameters.put("subject", subject);
		parameters.put("body", body);
		parameters.put("total_fee", total_fee);
		parameters.put("seller_email", seller_email);
		
		return parameters;
	}
	
}
